/**
 * Created by asus on 2017/8/2.
 */
$(function () {
    var brandTitleId=getUrlParams('brandtitleid');
    $.ajax({
        url:'http://127.0.0.1:3000/api/getbrand',
        dataType:'json',
        data:{brandtitleid:brandTitleId},
        success:function(data) {
            console.log(data);
            var html=template('ten-big-template',data);
            $('.whohao').html(html);


            $.ajax({
                url:'http://127.0.0.1:3000/api/getbrandproductlist',
                dataType:'json',
                data:{brandtitleid:0,pagesize:4},
                success:function (data) {
                    console.log(data);
                    var html=template('paihang-template',data)
                    $('.paihang').html(html);

                    $.ajax({
                        url:'http://127.0.0.1:3000/api/getproductcom',
                        dataType:'json',
                        data:{productid:brandTitleId},
                        success:function (data) {
                            var html=template('appraise',data);
                            $('pinglun').html(html);
                        }
                    })


                    $.ajax({
                        url:'http://127.0.0.1:3000/api/getproductcom',
                        data:{productid:brandTitleId},
                        dataType:'json',
                        success:function (data) {
                            console.log(data);

                            var tmpData = {
                                result:[data.result[0],data.result[1]]
                            };


                            var html=template('appraise',tmpData);

                            $('#product>.product-appraise').html(html);


                            $(".product-b > p").click(function(){
                                console.log("click");
                                var html=template('appraise',data);
                                $('#product>.product-appraise').html(html);

                            });
                        }
                    })


                }
            })
        }
    })

})